package com.intellij.ide.license.impl;

import com.intellij.licensecommon.data.LicenseData;
import com.jetbrains.licenseService.responses.EncodedAsset;
import com.jetbrains.licenseService.responses.License;

import java.util.Date;

public class JetProfileLicenseData implements LicenseData {
    private final String userId;
    private final String b;
    private final int licenseType;
    private final EncodedAsset encodedAsset;

    private final License license;
    private boolean f;
    private boolean g;

    public JetProfileLicenseData( String userId, String paramString2, int licenseType,  EncodedAsset encodedAsset,  License license) {
        this.userId = userId;
        this.b = paramString2;
        this.licenseType = licenseType;
        this.f = true;
        this.g = false;
        this.encodedAsset = encodedAsset;
        this.license = license;
    }


    public String r() {
        return this.b;
    }


    public String getUserId() {
        String userId = this.userId;
        if (userId == null) {
            throw new IllegalStateException(String.format(" method %s.%s must not return null", new Object[]{"com/intellij/ide/license/impl/JetProfileLicenseData", "getUserId"}));
        }
        return userId;
    }


    public EncodedAsset getEncodedAsset() {
        EncodedAsset encodedAsset = this.encodedAsset;
        if (encodedAsset == null) {
            throw new IllegalStateException(String.format(" method %s.%s must not return null", new Object[]{"com/intellij/ide/license/impl/JetProfileLicenseData", "getEncodedAsset"}));
        }
        return encodedAsset;
    }


    public License getLicense() {
        License license = this.license;
        if (license == null) {
            throw new IllegalStateException(String.format(" method %s.%s must not return null", new Object[]{"com/intellij/ide/license/impl/JetProfileLicenseData", "getLicense"}));
        }
        return license;
    }

    @Override
    public Date getExpirationDate() {
        return this.license.getExpirationDate();
    }

    @Override
    public Date getGenerationDate() {
        return new Date();
    }

    @Override
    public void setFromUser(boolean paramBoolean) {
        this.g = paramBoolean;
    }

    @Override
    public int getLicenseType() {
        return this.licenseType;
    }

    @Override
    public String getKey() {
        return "";
    }

    @Override
    public int getMajorVersion() {
        return this.license.getProductVersion();
    }

    @Override
    public String getUsername() {
        return this.license.getLicensedTo();
    }

    @Override
    public boolean isAccepted() {
        return this.f;
    }

    @Override
    public boolean isEvaluationExpired(Date paramDate) {
        Date expirationDate = getExpirationDate();
        return (expirationDate != null) && (paramDate != null) && (paramDate.after(expirationDate));
    }

    @Override
    public boolean isFromUser() {
        return this.g;
    }

    @Override
    public boolean isAcademic() {
        return false;
    }

    @Override
    public boolean isOpenSource() {
        return false;
    }

    @Override
    public boolean isPersonal() {
        return false;
    }

    @Override
    public boolean k() {
        return false;
    }

    @Override
    public boolean isValid() {
        return true;
    }

    @Override
    public boolean isClassroom() {
        return false;
    }

    @Override
    public void setAccepted(boolean accepted) {
        this.f = accepted;
    }

    @Override
    public boolean i() {
        return this.license.isDetectDuplicates();
    }

    @Override
    public boolean willExpire() {
        return getExpirationDate() != null;
    }
}
